<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\Article */

$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => '文章管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="box">
    <div class="box-header">
        <div class="btn-group">
            <?= Html::a('<i class="fa fa-pencil"></i>', ['update', 'id' => $model->id], ['class' => 'btn btn-default']) ?>
            <?= Html::a('<i class="fa fa-trash-o"></i>', ['delete', 'id' => $model->id], [
                'class' => 'btn btn-default',
                'data' => [
                    'confirm' => '您确定要删除该用户吗？',
                    'method' => 'post',
                ],
            ]) ?>
            <!-- /.btn-group -->
        </div>
        <div class="pull-right">
            <?= Html::a('<i class="fa fa-reply"></i>', ['index'], ['class' => 'btn btn-default']) ?>
        </div>
    </div>
    <!-- /.box-header -->
    <div class="box-body no-padding">
        <?= DetailView::widget([
            'model' => $model,
            'attributes' => [
                'id',
                [
                    'attribute'=>'icon',
                    'format' => ['image', ['width'=> 150]],
                    'value' => function($model){
                        return $model->file->file_path;
                    }
    
                ],
                [
                    'attribute' => 'is_show',
                    'value' => function($model){
                        return $model->is_show == 1 ? '显示' : '不显示';
                    }
                ],
                'title',
                [
                    'attribute' => 'classify',
                    'value' => function($model){
                        /** @var \common\models\Article $model */
                        return $model->getClassify()[$model->classify];
                    }
                ],
                [
                    'attribute' => 'updated_at',
                    'value' => date('Y-m-d H:i:s', $model->created_at),
                ]
            ],
        ]) ?>

    </div>
    <!-- /.box-body -->
</div>

